package com.snowRemovingUser.service.impl;

import com.snowRemovingUser.domain.TOperation;
import com.snowRemovingUser.mapper.TOperationMapper;
import com.snowRemovingUser.service.ITOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 操作日志Service业务层处理
 *
 * @author liguang
 * @date 2023-04-27
 */
@Service
public class TOperationServiceImpl implements ITOperationService
{
    @Autowired
    private TOperationMapper tOperationMapper;

    /**
     * 查询操作日志
     *
     * @param operId 操作日志主键
     * @return 操作日志
     */
    @Override
    public TOperation selectTOperationByOperId(Long operId)
    {
        return tOperationMapper.selectTOperationByOperId(operId);
    }

    /**
     * 查询操作日志列表
     *
     * @param tOperation 操作日志
     * @return 操作日志
     */
    @Override
    public List<TOperation> selectTOperationList(TOperation tOperation)
    {
        List<TOperation> tOperations = tOperationMapper.selectTOperationList(tOperation);

        for (TOperation operation : tOperations) {

            operation.setOperIp("******");
        }

        return tOperations;
    }

    /**
     * 新增操作日志
     *
     * @param tOperation 操作日志
     * @return 结果
     */
    @Override
    public int insertTOperation(TOperation tOperation)
    {
        return tOperationMapper.insertTOperation(tOperation);
    }

    /**
     * 修改操作日志
     *
     * @param tOperation 操作日志
     * @return 结果
     */
    @Override
    public int updateTOperation(TOperation tOperation)
    {
        return tOperationMapper.updateTOperation(tOperation);
    }

    /**
     * 批量删除操作日志
     *
     * @param operIds 需要删除的操作日志主键
     * @return 结果
     */
    @Override
    public int deleteTOperationByOperIds(Long[] operIds)
    {
        return tOperationMapper.deleteTOperationByOperIds(operIds);
    }

    /**
     * 删除操作日志信息
     *
     * @param operId 操作日志主键
     * @return 结果
     */
    @Override
    public int deleteTOperationByOperId(Long operId)
    {
        return tOperationMapper.deleteTOperationByOperId(operId);
    }
}
